*------------------------------------STUDY 2: UK PARTISAN EXPERIMENT---------------------------------*

**** Experimental treatments
** Manipulation of Bennett's & Smith's partisanship
generate cand_party =.
replace cand_party = 0 if splitexp == 1 
replace cand_party = 0 if splitexp == 2
replace cand_party = 0 if splitexp == 3 
replace cand_party = 0 if splitexp == 4 
replace cand_party = 1 if splitexp == 5
replace cand_party = 1 if splitexp == 6
replace cand_party = 1 if splitexp == 7
replace cand_party = 1 if splitexp == 8
label define cand_partyLB 0 "Labour" 1 "Conservative"
label values cand_party cand_partyLB

** Manipulation of Bennett's Warmth
generate Warmth_exp =.
replace Warmth_exp = 0 if splitexp == 2 
replace Warmth_exp = 0 if splitexp == 4
replace Warmth_exp = 0 if splitexp == 6 
replace Warmth_exp = 0 if splitexp == 8 
replace Warmth_exp = 1 if splitexp == 1
replace Warmth_exp = 1 if splitexp == 3
replace Warmth_exp = 1 if splitexp == 5
replace Warmth_exp = 1 if splitexp == 7
label define Warmth_expLB 0 "Low Warmth" 1 "High Warmth"
label values Warmth_exp Warmth_expLB

** Manipulation of Bennett's Competence
generate Comp_exp =.
replace Comp_exp = 0 if splitexp == 3
replace Comp_exp = 0 if splitexp == 4
replace Comp_exp = 0 if splitexp == 7
replace Comp_exp = 0 if splitexp == 8
replace Comp_exp = 1 if splitexp == 1
replace Comp_exp = 1 if splitexp == 2
replace Comp_exp = 1 if splitexp == 5
replace Comp_exp = 1 if splitexp == 6
label define Comp_expLB 0 "Low Competence" 1 "High Competence"
label values Comp_exp Comp_expLB



**** Outcome variables

** Manipulation checks
* Bennett Warmth
generate Warmth_Ben = (al2_1-1)/6
* Standardized variable
egen Warmth_Ben_std = std(Warmth_Ben)

* Smith Warmth
generate Warmth_Smith = (al3_1-1)/6
* Standardized variable
egen Warmth_Smith_std = std(Warmth_Smith)

* Bennett Competence
generate Comp_Ben = (al4_1-1)/6
* Standardized variable
egen Comp_Ben_std = std(Comp_Ben)

* Smith Competence
generate Comp_Smith = (al5_1-1)/6
* Standardized variable
egen Comp_Smith_std = std(Comp_Smith)


** Feeling thermometer ratings
* Bennett
generate Feel_Ben = (al6_1-1)/6
* Smith
generate Feel_Smith = (al10_1-1)/6

** Vote intention
recode a20 (1 = 0) (2 = 1) (else =.)
recode b20 (1 = 0) (2 = 1) (else =.)
egen vote = rowmean(a20 b20)
label define vote_expLB 0 "Smith" 1 "Bennett"
label values vote voteLB


**-------------------------------------------------- ANALYSES ----------------------------------------------**

** Predicting feeling thermometer ratings
* Experimental condition as predictor variables
reg Feel_Ben i.Comp_exp i.Warmth_exp

margins, dydx(Comp_exp Warmth_exp)  level(95) noestimcheck 
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#2) ylabel(0 (0.1) 0.3) ///
xtitle(trait evaluations) ytitle(Marginal effect of traits on feeling thermometer ratings) title("") scheme(s2color) ///
name(Feel_EXP, replace)

* Standardized perceptions of competence and warmth
reg Feel_Ben c.Comp_Ben_std c.Warmth_Ben_std

margins, dydx(Comp_Ben_std Warmth_Ben_std)  level(95) noestimcheck 
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#2) ylabel(0 (0.1) 0.3) ///
xtitle(trait evaluations) ytitle(Marginal effect of traits on feeling thermometer ratings) title("") scheme(s2color) ///
name(Feel_PERCEPTION, replace)

graph combine Feel_EXP Feel_PERCEPTION

** Predicting vote choice
* Experimental condition as predictor variables
logit vote i.Comp_exp i.Warmth_exp

margins, dydx(Comp_exp Warmth_exp)  level(95) noestimcheck 
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#2) ylabel(0 (0.1) 0.5) ///
xtitle(trait evaluations) ytitle(Marginal effect of traits on feeling thermometer ratings) title("") scheme(s2color) ///
name(vote_EXP, replace)

* Standardized perceptions of competence and warmth
logit vote c.Comp_Ben_std c.Warmth_Ben_std

margins, dydx(Comp_Ben_std Warmth_Ben_std)  level(95) noestimcheck 
marginsplot, recastci(rcap) ciopts(lpattern(dash)) recast(bar) yline(0) xlabel(#2) ylabel(0 (0.1) 0.5) ///
xtitle(trait evaluations) ytitle(Marginal effect of traits on feeling thermometer ratings) title("") scheme(s2color) ///
name(vote_PERCEPTION, replace)

graph combine vote_EXP vote_PERCEPTION
